package com.pkuse.bjousystem;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

@Configuration
@PropertySource("classpath:password.properties")
public class SchoolPasswordConfiguration {

    @Autowired
    Environment env;

    public String getPassword(String id) {
        String password = env.getProperty(id);
        if (password == null) {
            return env.getProperty("default");
        } else {
            return password;
        }
    }
}
